<?php

/**
 * Klasa do odczytywania konfiguracji
 * @author Miron Pawlik
 */

class Config implements ArrayAccess
{
	private $array;
	
	public function __construct(dbHandler $db)
	{
		$this->reload($db);
	}
	
	public function reload($db)
	{
		$this->array = $db->getData('config');
	}
	public function offsetExists ($offset)
	{
		return isset($this->array[$offset]);
			
	}
 	public function offsetGet ($offset)
	{
		if(isset($this->array[$offset]))
			return $this->array[$offset];
		else
		{
			echo "Error: key '$offset' doesn't exist";
			debug_print_backtrace();
		}
	}
 	public function offsetSet ($offset, $value)
	{
		return $this->array[$offset] = $value;
	}
 	public function offsetUnset ($offset)
	{
		unset($a);
	}
}
